<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'base.item.class.php');

class DownloadBase extends BaseItemBase {
	
	//constructor
	function DownloadBase() {
		parent::BaseItemBase();
		
		$this->item_link = true;
		$this->table = 'pp_m_downloads';
		$this->prefix = 'm_';
	}
	
	//methods
	function onAddItemFilterBind($data_array) {
		$fb = array();
		$fb['_file'] = $data_array['m_pupfile'];
		$fb['_filename'] = $data_array['m_pupfile_filename'];
		$fb['_filesize'] = $data_array['m_pupfile_filesize'];
		$fb['_filerid'] = $data_array['m_pupfile_param'];
		
		return $fb;
	}
	
	//download
	function addDownloadCount($items_id) {
		$data_array = array('_ds' => 'add_one()');
		
		return $this->updateItem($items_id, $data_array);
	}
	
	function addDownloadHistory($items_id) {
		return false;
	}
}
//
?>